-
-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should only add public interfaces #123
Conversation
If the interface is not public, the castle dynamic proxy will throw: Castle.DynamicProxy.Generators.GeneratorException : Type System.Data.Entity.Internal.Linq.IInternalQueryAdapter is not visible to DynamicProxy. Can not create proxy for types that are not accessible. Make the type public, or internal and mark your assembly with [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)] attribute.
use tabs instead of spaces
Hi @kzu , sorry to bother you again, the previous pull request #119 caused some breaking issues.
This pull request fixed the issues listed above and passed all UT and also added 2 UTs. Could you please help take a look? Thanks in advance! |
Looks good. I guess it will be hard to let those that are InternalsVisibleTo go through still? |
@@ -33,8 +33,9 @@ internal class InvokeBase : IInterceptStrategy | |||
{ | |||
public InterceptionAction HandleIntercept(ICallContext invocation, InterceptorContext ctx, CurrentInterceptContext localctx) | |||
{ | |||
if (invocation.Method.DeclaringType == typeof(object) || | |||
invocation.Method.DeclaringType.IsClass && !invocation.Method.IsAbstract && ctx.Mock.CallBase | |||
if (invocation.Method.DeclaringType == typeof(object) || // interface proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition makes my brain hurt :(. Not sure how to improve it significantly though :(
Probably it could: check the interface's assembly and see if the assembly has the corresponding attribute. 发自我的 iPhone 在 2014年8月7日,1:16,"Daniel Cazzulino" notifications@github.com 写道: Looks good. I guess it will be hard to let those that are InternalsVisibleTo go through still? — |
That would be great :)
|
If the interface is not public, the castle dynamic proxy will throw:
Castle.DynamicProxy.Generators.GeneratorException : Type
System.Data.Entity.Internal.Linq.IInternalQueryAdapter is not visible to
DynamicProxy. Can not create proxy for types that are not accessible.
Make the type public, or internal and mark your assembly with [assembly:
InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)]
attribute.